package lore.miniwechat.service.impl;

import lore.miniwechat.entity.Chatrecord;
import lore.miniwechat.mapper.ChatrecordMapper;
import lore.miniwechat.service.ChatrecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ChatrecordServiceImpl implements ChatrecordService {

    @Autowired
    ChatrecordMapper mapper;


    @Override
    public void insert(Chatrecord chatrecord) {
        mapper.insertSelective(chatrecord);
    }

    @Override
    public void deleteById(String id) {
        Chatrecord chatrecord = mapper.selectByPrimaryKey(id);
        chatrecord.setState(0);
        mapper.updateByPrimaryKey(chatrecord);

    }

    @Override
    public List<Chatrecord> getRecord() {
        return mapper.selectByExample(null);
    }
}
